﻿using System.Web;
using ErrorDumper.Processing;
using ErrorDumper.PropertyExtracting;

namespace ErrorDumper.Web.Processors {
    public class HttpContextExceptionProcessor : IExceptionProcessor {
        public void ProcessException(ExceptionProcessorContext processorContext) {
            var current = HttpContext.Current;
            if (current == null)
                return;

            var properties = processorContext.Properties;
            ExceptionPropertyExtractors.ExtractProperties(
                ref properties, new HttpContextWrapper(current));
            processorContext.Properties = properties;
        }
    }
}